package com.heima.user.controller.v1;


import com.heima.common.constants.admin.AdminConstants;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dtos.AuthDTO;
import com.heima.user.service.ApUserRealnameService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/auth")
@Api(value = "实名认证controller",tags = "实名认知controller")
public class ApUserRealnameController {
    @Autowired
    public ApUserRealnameService apUserRealnameService;

    @PostMapping("/list")
    @ApiOperation("认证失败")
    public ResponseResult list(@RequestBody AuthDTO dto){
        return apUserRealnameService.loadListByStatus(dto);
    }


    @PostMapping("/authFail")
    @ApiOperation("分页查询实名认证列表")
    public ResponseResult authFail(@RequestBody AuthDTO dto){

        return apUserRealnameService.updateStatusById(dto, AdminConstants.FAIL_AUTH);
    }


    @PostMapping("/authPass")
    @ApiOperation("认证通过")
    public ResponseResult authPass(@RequestBody AuthDTO dto){

        return apUserRealnameService.updateStatusById(dto,AdminConstants.PASS_AUTH);
    }

}
